package com.ruoyi.common.config.websockert3;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * @author Fql18
 * @version 1.0
 * @date 2025-08-19 23:38
 * @description
 */
@Configuration
@EnableWebSocket
public class WebSocketConfig3 implements WebSocketConfigurer {
	@Override
	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(new WebSocketServerHandler(), "/ws")
			.setAllowedOrigins("*");   // 允许浏览器跨域
	}
}
